package vip.bblog.user.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import vip.bblog.common.utils.BaseResult;
import vip.bblog.user.entity.BlogQqUser;
import vip.bblog.user.service.BlogQqUserService;

/**
 * <p>
 * QQ用户基本信息表 前端控制器
 * </p>
 *
 * @author yuyong
 * @since 2019-04-28
 */
@RestController
@RequestMapping("/user/qq")
public class BlogQqUserController {

    @Autowired
    private BlogQqUserService qqUserService;


    @ApiOperation(value = "根据openId禁用用户", notes = "根据openId禁用用户")
    @DeleteMapping("/{openId}")
    public BaseResult<Object> deleteById(@PathVariable(value = "openId") String openId) {
        return qqUserService.disableByOpenId(openId);
    }

    @ApiOperation(value = "模糊分页查询用户", notes = "模糊分页查询用户")
    @GetMapping
    public BaseResult<Object> selectPageByExample(Page<BlogQqUser> page, BlogQqUser qqUser) {
        return qqUserService.selectPageByExample(page, qqUser);
    }


    @ApiOperation(value = "根据openId查询用户信息", notes = "根据openId查询用户信息")
    @GetMapping("/{openId}")
    public BaseResult<Object> select(@PathVariable(value = "openId") String openId) {
        return new BaseResult<>(qqUserService.getById(openId));
    }
}
